.class public Lcom/glympse/platform/common/FacebookJobs$UpgradeSessionJob;
.super Lcom/glympse/platform/common/HttpJob;
.source "FacebookJobs.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/glympse/platform/common/FacebookJobs;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x9
    name = "UpgradeSessionJob"
.end annotation


# direct methods
.method public constructor <init>(Ljava/lang/String;)V
    .locals 2
    .parameter "strOldSession"

    .prologue
    .line 27
    invoke-direct {p0}, Lcom/glympse/platform/common/HttpJob;-><init>()V

    .line 29
    new-instance v0, Ljava/lang/StringBuilder;

    const-string v1, "FacebookJobs.UpgradeSessionJob("

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, ")"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/String;)V

    .line 30
    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/glympse/platform/common/FacebookJobs$UpgradeSessionJob;->m_fCompleteOnMainThread:Z

    .line 31
    new-instance v0, Ljava/lang/StringBuilder;

    const-string v1, "https://graph.facebook.com/oauth/exchange_sessions?type=client_cred&client_id=1dc5600ca56c7173b52ee97e90fd4ca3&client_secret=d0c7ed03c951546bd3812c766f85ca29&sessions="

    invoke-direct {v0, v1}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    iput-object v0, p0, Lcom/glympse/platform/common/FacebookJobs$UpgradeSessionJob;->m_strUrl:Ljava/lang/String;

    .line 32
    return-void
.end method


# virtual methods
.method public OnComplete(Lcom/glympse/platform/common/JobQueue;)V
    .locals 5
    .parameter "oJobQueue"

    .prologue
    .line 38
    invoke-virtual {p0}, Lcom/glympse/platform/common/FacebookJobs$UpgradeSessionJob;->DumpDownload()V

    .line 41
    iget-boolean v3, p0, Lcom/glympse/platform/common/FacebookJobs$UpgradeSessionJob;->m_fSuccess:Z

    if-eqz v3, :cond_1

    iget-object v3, p0, Lcom/glympse/platform/common/FacebookJobs$UpgradeSessionJob;->m_abResponse:[B

    if-eqz v3, :cond_1

    .line 43
    new-instance v3, Lcom/glympse/platform/common/CharArrayPointer;

    iget-object v4, p0, Lcom/glympse/platform/common/FacebookJobs$UpgradeSessionJob;->m_abResponse:[B

    invoke-direct {v3, v4}, Lcom/glympse/platform/common/CharArrayPointer;-><init>([B)V

    invoke-static {v3}, Lcom/glympse/platform/common/Helpers;->ParseJSON(Lcom/glympse/platform/common/CharArrayPointer;)Lcom/glympse/platform/GVector$NameValueNodes;

    move-result-object v1

    .line 44
    .local v1, listNameValues:Lcom/glympse/platform/GVector$NameValueNodes;,"Lcom/glympse/platform/GVector$NameValueNodes;"
    if-eqz v1, :cond_1

    .line 47
    invoke-virtual {v1}, Lcom/glympse/platform/GVector$NameValueNodes;->elements()Ljava/util/Enumeration;

    move-result-object v0

    .local v0, iter:Ljava/util/Enumeration;
    :cond_0
    invoke-interface {v0}, Ljava/util/Enumeration;->hasMoreElements()Z

    move-result v3

    if-nez v3, :cond_2

    .line 62
    .end local v0           #iter:Ljava/util/Enumeration;
    .end local v1           #listNameValues:Lcom/glympse/platform/GVector$NameValueNodes;,"Lcom/glympse/platform/GVector$NameValueNodes;"
    :cond_1
    :goto_0
    return-void

    .line 49
    .restart local v0       #iter:Ljava/util/Enumeration;
    .restart local v1       #listNameValues:Lcom/glympse/platform/GVector$NameValueNodes;,"Lcom/glympse/platform/GVector$NameValueNodes;"
    :cond_2
    invoke-interface {v0}, Ljava/util/Enumeration;->nextElement()Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Lcom/glympse/platform/common/NameValueNode;

    .line 52
    .local v2, oNodeCur:Lcom/glympse/platform/common/NameValueNode;
    iget-object v3, v2, Lcom/glympse/platform/common/NameValueNode;->m_strName:Ljava/lang/String;

    invoke-static {v3}, Lcom/glympse/platform/common/Helpers;->IsEmpty(Ljava/lang/String;)Z

    move-result v3

    if-nez v3, :cond_0

    iget-object v3, v2, Lcom/glympse/platform/common/NameValueNode;->m_strValue:Ljava/lang/String;

    invoke-static {v3}, Lcom/glympse/platform/common/Helpers;->IsEmpty(Ljava/lang/String;)Z

    move-result v3

    if-nez v3, :cond_0

    .line 53
    iget-object v3, v2, Lcom/glympse/platform/common/NameValueNode;->m_strName:Ljava/lang/String;

    const-string v4, "access_token"

    invoke-virtual {v3, v4}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v3

    if-eqz v3, :cond_0

    .line 55
    new-instance v3, Ljava/lang/StringBuilder;

    const-string v4, "FacebookJobs.UpgradeSessionJob.OnComplete: "

    invoke-direct {v3, v4}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    iget-object v4, v2, Lcom/glympse/platform/common/NameValueNode;->m_strValue:Ljava/lang/String;

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v3

    invoke-static {v3}, Lcom/glympse/platform/common/Helpers;->Log(Ljava/lang/String;)V

    .line 56
    iget-object v3, v2, Lcom/glympse/platform/common/NameValueNode;->m_strValue:Ljava/lang/String;

    invoke-static {v3}, Lcom/glympse/platform/GFacebook;->SetUpgradedSession(Ljava/lang/String;)V

    goto :goto_0
.end method
